package com.itheima.config;

import com.itheima.filter.ZhzGrayFilter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.cloud.gateway.config.LoadBalancerProperties;
import org.springframework.cloud.loadbalancer.support.LoadBalancerClientFactory;
import org.springframework.context.annotation.Bean;

/**
 * @program: springcloud
 * @description: 加载配置
 * @author: zhanghz001
 * @create: 2021-08-02 18:55
 **/
// @Configuration
public class ZhzGrayBalanceConfig {
    
    /**
     * 过滤器配置
     *
     * @param clientFactory
     * @param properties
     * @return
     */
    @Bean
    @ConditionalOnMissingBean(ZhzGrayFilter.class)
    public ZhzGrayFilter grayFilter(LoadBalancerClientFactory clientFactory, LoadBalancerProperties properties) {
        return new ZhzGrayFilter(clientFactory, properties);
    }
}
